import React from 'react';
import { ts2Formatter, renderState } from 'utils';
import { actions } from 'mirrorx';
{/*
可配置化种类：

1、表格头部字段 
    1、列表页表格头部字段集合 mainTableColumn
    2、编辑页表格头部字段集合 childTableColumn

2、编辑框的字段
    1、编辑页 直接显示在页面的编辑字段 FormField
    2、编辑页 需要点击表格的增行弹框编辑的字段 FormTableField
    3. 列表页查询区域  searchField

3.表头部的按钮  headerButtonSets

4.表行尾部按钮  columnButtonSets
*/}

//表头信息

//字段属性

//基本信息
const FormDataHeader = [
    {
        enname: "operationTypeId",
        codename: "operationTypeCode",
        showname: "operationTypeName",
        zhname: "操作类型",
        type: "Select",
        hidepage: { 0: true,3:true,1:true },
        code: "OPERATION_TYPE",
        required: true,
        edit: true,
    },
    {
        enname: "branchbfficeId",
        showname: "branchbfficeName",
        codename: "branchbfficeCode",
        zhname: "隶属组织",
        type: "RefComponent",
        refname: "organization",
        edit: true,
        cascadeName: [
            {
                paramkey: "EQ_organization.id",
                childtype: "DataHeader",
                refKey: "refpk",
                dtoKey: "branchbfficeId",
                offers: "departmentId",  //部门
                resetOffersFlag: true,
            },{
                paramkey: "EQ_organization.id",
                childtype: "DataHeader",
                refKey: "refpk",
                dtoKey: "branchbfficeId",
                offers: "storecodeId",  //部门
                resetOffersFlag: true,
            }],
        cascadeChildTable:[{
            refKey: "refpk", 
            dtoKey: "organizationId",
            childType:"activityDetails" 
        }],
        param:{
            "AUTH_refdim":"branchbffice","AUTH_refcod":"promoter"
        },
        required: true,
    },
    {
        enname: "name",
        zhname: "促销员姓名",
        type: "FormControl",
        pattern:/^\S*$/,
        message: "不能有空格",
        required: true,
        edit: true,
    },
    {
        enname: "billStatusId",
        codename: "auditstateCode",
        showname: "billStatusName",
        zhname: "审批状态",
        type: "Select",
        hidepage: { 0: true },
        code: "BILL_STATUS",
        required: false,
        edit: false,
    },
    {
        enname: "storecodeId",
        codename: "storecodeCode",
        showname: "storecodeName",
        zhname: "门店名称",
        refname: "terminal",
        alias:"branchbfficeId",
        size: "md",
        required: true,
        relation: [
            {
                ref: "retailId",
                refpk: "retailId",
                refname: "retailName",
                refcode: "retailCode",
                relationType:"ref"
            },
            {
                ref: "regionId",
                refpk: "regionId",
                refname: "regionName",
                refcode: "regionCode",
                relationType:"ref"
            },
            {
                ref: "shippingareaId",
                refpk: "shippingareaId",
                refname: "shippingareaName",
                refcode: "shippingareaCode",
                relationType:"ref"
            }
        ],
        type: "RefComponent",
        edit: true,
    },
    {
        enname: "terminalsupplierId",
        codename: "terminalsupplierCode",
        showname: "terminalsupplierName",
        zhname: "隶属客户名",
        size: "md",
        refname: "terminalcustomerRef",
        param:{"EQ_isFrozen": "0"},
        type: "RefComponent",
        edit: false,
    },
    {
        enname: "riscode",
        zhname: "RIS编码",
        refname: "terminal",
        type: "FormControl",
        pattern:/^\S*$/,
        message: "不能有空格",
        edit: false,
    },
    {
        enname: "customerChannelsId",
        codename: "customerChannelsCode",
        showname: "customerChannelsName",
        zhname: "渠道",
        refname: "custchantype",
        type: "RefComponent",
        edit: false,
    },
    {
        enname: "provinceId",
        codename: "provinceCode",
        showname: "provinceName",
        zhname: "省份",
        type: "RefComponent",
        refname: "areaRef",
        param: {
            EQ_areaLevel: "1",
        },
        cascadeName: {
            paramkey: "EQ_parent.id",
            childtype: "DataHeader",
            refKey: "refpk",
            dtoKey: "provinceId",
            offers: "cityId",
            resetOffersFlag: true,
        },
        edit: false,
        // required: true,
    },
    {
        enname: "cityId",
        codename: "cityCode",
        showname: "cityName",
        zhname: "市",
        refname: "areaRef",
        type: "RefComponent",
        edit: false,
        cascadeName: {
            paramkey: "EQ_parent.id",
            childtype: "DataHeader",
            refKey: "refpk",
            dtoKey: "cityId",
            offers: "countyId",
            resetOffersFlag: true,
        },
        param: {
            EQ_areaLevel: "2",
        },
        alias: "provinceId",
    },
    {
        enname: "countyId",
        codename: "countyCode",
        showname: "countyName",
        zhname: "区/县",
        refname: "areaRef",
        type: "RefComponent",
        edit: false,
        param: {
            EQ_areaLevel: "3",
        },
        cascadeName: {
            paramkey: "EQ_parent.id",
            childtype: "DataHeader",
            refKey: "refpk",
            dtoKey: "countyId",
            offers: "townId",
            resetOffersFlag: true,
        },
        alias: "cityId",
        // edit: true,
        // required: true,
    },
    {
        enname: "townId",
        codename: "townCode",
        showname: "townName",
        zhname: "镇/街道",
        refname: "areaRef",
        type: "RefComponent",
        param: {
            EQ_areaLevel: "4",
        },
        alias: "countyId",
        edit: false,
        // required: true,
    },
    {
        enname: "blameserviceId",
        codename: "blameserviceCode",
        showname: "blameserviceName",
        zhname: "发运业务",
        refname: "terminalPersonRef",
        type: "RefComponent",
        edit: false,
    },
    {
        enname: "ext05",
        codename: "ext05Code",
        showname: "ext05Name",
        zhname: "零售业务",
        refname: "terminalPersonRef",
        type: "RefComponent",
        edit: true,
    },
    // {
    //     enname: "saleareaId",
    //     codename: "saleareaCode",
    //     showname: "saleareaName",
    //     refname: "marketareas",
    //     zhname: "大区",
    //     type: "RefComponent",
    //     edit: false,
    // },
    // {
    //     enname: "saleregionId",
    //     codename: "saleregionCode",
    //     showname: "saleregionName",
    //     refname: "marketareas",
    //     zhname: "地区",
    //     type: "RefComponent",
    //     edit: false,
    // },
    {
        enname: "regionId",
        codename: "regionCode",
        showname: "regionName",
        refname: "marketareas",
        zhname: "区域市场",
        type: "RefComponent",
        edit: false,
    },
    {
        enname: "shippingareaId",
        codename: "shippingareaCode",
        showname: "shippingareaName",
        refname: "departmentRef",
        zhname: "发运片区",
        type: "RefComponent",
        edit: false,
    },
    {
        enname:"shippingareaSecLevelName",
        zhname:"发运地区",
        required: false,
        hidepage:{0:true,1:true,2:false},
        type: "FormControl",
        edit: false
    },
    {
        enname:"shippingareaStairName",
        zhname:"发运大区",
        required: false,
        hidepage:{0:true,1:true,2:false},
        type: "FormControl",
        edit: false
    },
    {
        enname: "retailId",
        codename: "retailCode",
        showname: "retailName",
        refname: "departmentRef",
        zhname: "零售片区",
        type: "RefComponent",
        edit: false,
    },
    {
        enname:"retailSecLevelName",
        zhname:"零售地区",
        required: false,
        hidepage:{0:true,1:true,2:false},
        type: "FormControl",
        edit: false
    },
    {
        enname:"retailStairName",
        zhname:"零售大区",
        required: false,
        hidepage:{0:true,1:true,2:false},
        type: "FormControl",
        edit: false
    },
    {
        enname: "code",
        zhname: "促销员编码",
        type: "FormControl",
        pattern:/^\S*$/,
        message: "不能有空格",
        edit: false,
        hidepage: { 0: true, 1: false, 2: false },
        required: true,
    },
    {
        enname: "cardId",
        zhname: "身份证号码",
        type: "FormControl",
        pattern: /^([1-6][1-9]|50)\d{4}(18|19|20)\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/,
        message: "请输入正确的18位身份证号",
        edit: true,
        required:true,
    },
    {
        enname: "genderId",
        codename: "genderCode",
        showname: "genderName",
        zhname: "性别",
        code: "QY020",
        type: "Select",
        edit: false,
    },
    {
        enname: "birthDate",
        zhname: "出生日期",
        type: "DatePicker",
        format: "YYYY-MM-DD",
        edit: false,
    },
    {
        enname: "age",
        zhname: "年龄",
        type: "InputNumber",
        min:10,
        max:100,
        edit: false,
    },
    {
        enname: "tel",
        zhname: "联系电话",
        pattern: /^[0-9]{11}$/,
        message: "11位的数字",
        type: "FormControl",
        edit: true,
        required:true,
    },
    {
        enname: "householdId",
        codename: "householdCode",
        showname: "householdName",
        zhname: "户籍地址",
        type: "RefComponent",
        refname: "proviceCityRef",
        edit: true,
    },
    {
        enname: "departmentId",
        showname: "departmentName",
        codename: "departmentCode",
        alias:"branchbfficeId",
        zhname: "任职部门",
        type: "RefComponent",
        refname: "departmentRef",
        param: {
            EQ_enableState: "0",
        },
        edit: true,
        required: true,
    },
    {
        enname: "address",
        zhname: "联系地址",
        type: "FormControl",
        componentClass: "textarea",
        pattern:/^\S*$/,
        message: "不能有空格",
        required: true,
        edit: true,
    },
    {
        enname: "promotertypeId",
        codename: "promotertypeCode",
        showname: "promotertypeName",
        zhname: "促销员类型",
        refname: "personType",
        type: "RefComponent",
        required: true,
        edit: true,
    },
    {
        enname: "commodityBrandId",
        codename: "commodityBrandCode",
        showname: "commodityBrandName",
        zhname: "商品品牌",
        refname: "brandref",
        type: "RefComponent",
        required: true,
        edit: true,
    },
    {
        enname: "goodsCategoryId",
        codename: "goodsCategoryCode",
        showname: "goodsCategoryName",
        zhname: "商品品类",
        refname: "terminalGoodsCate",
        type: "RefComponent",
        required: true,
        edit: true,
    },
    {
        enname: "entryDate",
        zhname: "入职日期",
        type: "DatePicker",
        format: "YYYY-MM-DD",
        required:true,
        edit: true,
    },
    {
        enname: "arrivalDate",
        zhname: "入店日期",
        type: "DatePicker",
        format: "YYYY-MM-DD",
        hidepage: { 0: true, 1: true, 2: false },
        edit: false,
    },
    {
        enname: "years",
        zhname: "工龄",
        pattern:/^\S*$/,
        message: "不能有空格",
        type: "FormControl",
        edit: false,
    },
    {
        enname: "ext01Id",
        codename: "ext01",
        showname: "ext01Name",
        zhname: "是否生成用户",
        type: "Select",
        options: [
            {code:"Y",name:"是"},
            {code:"N",name:"否"}
        ],
        hidepage:{0:true},
        edit: false,
    },
    {
        enname: "turnoverStatus",
        zhname: "离职状态",
        type: "Radio",
        options: [{
            key: 1,
            value: "已离职"
        },
        {
            key: 0,
            value: "未离职"
        }
        ],
        showcontrol: [{
            value: 1,
            refKey: "code",
            dtoKey: "turnoverStatus",
            layer: ["FormField", "WorkInfoDataHeader", "Field"],
            fields: ["turnoverDate"]
        }],
        edit: false,
    },
    {
        enname:"formerName",
        zhname:"别名",
        required: false,
        type: "FormControl",
        edit: true
    },
    {
        enname:"politicalOutlook",
        zhname:"政治面貌",
        required: false,
        type: "FormControl",
        edit: true
    },
    {
        enname:"homeTown",
        zhname:"籍贯",
        required: false,
        type: "FormControl",
        edit: true
    },
    {
        enname:"maritalStatus",
        zhname:"婚姻状况",
        required: false,
        type: "FormControl",
        edit: true
    },
    {
        enname:"householdType",
        zhname:"户口性质",
        required: false,
        type: "FormControl",
        edit: true
    },
    {
        enname:"nation",
        zhname:"民族",
        required: false,
        type: "FormControl",
        edit: true
    },
    {
        enname:"bornPlace",
        zhname:"出生地",
        required: false,
        type: "FormControl",
        edit: true
    },
    {
        enname:"qualification",
        zhname:"学历",
        required: false,
        type: "FormControl",
        edit: true
    },
    {
        enname:"mail",
        zhname:"邮箱",
        required: false,
        type: "FormControl",
        edit: true
    },
];

const FormWorkInfoDataHeader = [
    {
        enname: "senioritypay",
        zhname: "工龄工资",
        type: "InputNumber",
        precision: 2,
        edit: true,
    },
    {
        enname: "management",
        zhname: "岗位名称",
        required: true,
        pattern:/^\S*$/,
        message: "不能有空格",
        type: "FormControl",
        edit: true,
    },
    {
        enname: "postcoefficient",
        zhname: "岗位系数",
        required: true,
        defaultValue: 0,
        precision: 2,
        type: "InputNumber",
        edit: true,
    },
    {
        enname: "workingHour",
        zhname: "工时制",
        type: "InputNumber",
        edit: true,
    },
    {
        enname: "rank",
        zhname: "级别",
        required: true,
        type: "InputNumber",
        edit: true,
    },
    {
        enname: "ratiorank",
        zhname: "级别系数",
        required: true,
        precision: 2,
        type: "InputNumber",
        edit: true,
    },
    {
        enname: "contractWage",
        zhname: "合同工资",
        precision: 2,
        type: "InputNumber",
        edit: true,
    },
    {
        enname: "baseSalary",
        zhname: "底薪",
        precision: 2,
        type: "InputNumber",
        edit: true,
    },
    {
        enname: "allowance",
        zhname: "补贴项目",
        precision: 2,
        type: "InputNumber",
        edit: true,
        required: false,
    },
    {
        enname: "commissionratio",
        zhname: "提成系数",
        precision: 2,
        type: "InputNumber",
        edit: true,
    },
    {
        enname: "addtoratio",
        zhname: "变动、追加系数",
        precision: 2,
        type: "InputNumber",
        edit: true,
    },
    {
        enname: "personalSecurity",
        zhname: "个人社保",
        precision: 2,
        type: "InputNumber",
        edit: true,
    },
    {
        enname: "socialCityId",
        codename: "socialCityCode",
        showname: "socialCityName",
        zhname: "社保缴纳城市",
        type: "RefComponent",
        refname: "areaRef",
        edit: true,
        param: {
            EQ_areaLevel: "2",
        },
        edit: true,
    },
    {
        enname: "companySecurity",
        zhname: "缴费基数",
        type: "InputNumber",
        precision: 2,
        edit: true,
    },
    {
        enname: "startingDate",
        zhname: "起缴年月",
        type: "DatePicker",
        format: "YYYY-MM-DD",
        edit: true,
    },
    {
        enname: "companySecurityPays",
        zhname: "公司是否缴纳社保",
        type: "Radio",
        options: [{
            "key": 1,
            "value": "已缴纳"
        }, {
            "key": 0,
            "value": "未缴纳"
        }],
        edit: true,
    },
    {
        enname: "paymentBase",
        zhname: "公司社保",
        precision: 2,
        type: "InputNumber",
        edit: true,
    },
    {
        enname: "accumulationfund",
        zhname: "公积金",
        precision: 2,
        type: "InputNumber",
        edit: true,
    },
    {
        enname: "jobTitle",
        zhname: "劳动费用",
        type: "InputNumber",
        precision: 2,
        edit: true,
    },
    {
        enname: "contractOwnership",
        zhname: "合同归属",
        pattern:/^\S*$/,
        message: "不能有空格",
        type: "FormControl",
        edit: true,
    }, {
        enname: "probation",
        zhname: "试用期",
        type: "InputNumber",
        edit: true,
    },
    {
        enname: "workingCityId",
        codename: "workingCityCode",
        showname: "workingCityName",
        zhname: "工作城市",
        type: "RefComponent",
        refname: "areaRef",
        edit: true,
        param: {
            EQ_areaLevel: "2",
        },
        edit: true,
    },
    {
        enname: "contractDate",
        zhname: "合同结束时间",
        type: "DatePicker",
        format: "YYYY-MM-DD",
        disabledDate:"entryDate",
        edit: true,
    },
    {
        enname: "turnoverDate",
        zhname: "离职日期",
        type: "DatePicker",
        disabledDate: "entryDate",
        format: "YYYY-MM-DD",
        edit: true,
    }, {
        enname: "lastLoginTime",
        zhname: "最后登录时间",
        type: "DatePicker",
        hidepage: { 0: true },
        format: "YYYY-MM-DD",
        edit: true,
    },
    {
        enname: "remarks",
        zhname: "备注",
        type: "FormControl",
        componentClass: "textarea",
        pattern:/^\S*$/,
        message: "不能有空格",
        edit: true,
    },
]

const columnportrait = [
    {
        title: "标题",
        dataIndex: "filename",
        key: "filename",
        detailwidth: 250,
    }, {
        title: "上传时间",
        dataIndex: "creationTime",
        key: "creationTime",
        detailwidth: 150,
        render: (text, record, index) => {
            return text && ts2Formatter(text,1);
        }
    }, {
        title: "缩略图",
        dataIndex: "fileUrl",
        key: "fileUrl",
        width: 150,
        render: (text, record, index) => {
            if(record.fileUrl.search("jpg") != -1 || record.fileUrl.search("jpeg") != -1 ||record.fileUrl.search("png") != -1){
                return <span>
                <img style={{"width":"35px"}} src={text} />
             </span>
            }else {
                return ""
            }
            
        }
    }, 
    {
        title: "创建人",
        dataIndex: "creator",
        key: "creator",
        width: 150,
    }
]

const columnpromoterChangement = [
    // {
    //     title: "维度显示",
    //     dataIndex: "dimensionshow",
    //     renderType: "input",
    //     filedProps: {
    //         maxLenght:20,
    //     },
    //     key: "dimensionshow"
    // },
    {
        title: "渠道",
        dataIndex: "customerChannelsName",
        key: "customerChannelsName",
        renderType: "refcomponent",
        width: 250,
        validate: false,
        hidepage: { 0: true, 1: true, 2: true },
        required: true,
        filedProps: {
            childType: "retailOrderItems",
            title: "渠道",
            refName: "custchantype",
            fieldName: "customerChannelsName",
            reffields: { refpk: "customerChannelsId", refname: "customerChannelsName", refcode: "customerChannelsCode" }
        },
    },
    {
        title: "区域",
        dataIndex: "regionName",
        key: "regionName",
        renderType: "refcomponent",
        width: 250,
        validate: false,
        hidepage: { 0: true, 1: true, 2: true },
        required: true,
        filedProps: {
            childType: "retailOrderItems",
            title: "区域",
            refName: "marketareas",
            fieldName: "regionName",
            reffields: { refpk: "regionId", refname: "regionName", refcode: "regionCode" }
        },
    },
    {
        title: "门店",
        dataIndex: "storecodeName",
        key: "storecodeName",
        renderType: "refcomponent",
        width: 250,
        hidepage: { 0: true, 1: true, 2: true },
        validate: false,
        required: true,
        filedProps: {
            childType: "retailOrderItems",
            title: "门店",
            refName: "terminal",
            aliasparam: [{
                paramkey: "EQ_organization.id",
                alias: "organizationId",
            }],
            fieldName: "storecodeName",
            reffields: { refpk: "storecodeId", refname: "storecodeName", refcode: "storecodeCode" }
        },
    },
    {
        title: "品名型号",
        dataIndex: "typeshowname",
        key: "typeshowname",
        renderType: "refcomponent",
        width: 250,
        validate: false,
        required: true,
        filedProps: {
            childType: "retailOrderItems",
            title: "品名型号",
            refName: "goodsRef",
            fieldName: "typeshowname",
            reffields: { refpk: "typenameId", refname: "typeshowname", refcode: "typenameCode" }
        },
    },
    {
        title: "目标价",
        dataIndex: "aimvalue",
        key: "aimvalue",
        renderType: "inputnumber",
        filedProps: {
            precision: 2,
            min: 0,
        },
        edit: true,
        required: false,
    },
    {
        title: "提成",
        dataIndex: "commission",
        key: "commission",
        width: 120,
        validate: true,
        renderType: "inputnumber",
        // required: true,
        filedProps: {
            precision:2,
            // except:0,
            min: 0,
        }
    },
    {
        dataIndex: "show",
        title: "备注",
        renderType: "input",
        pattern:/^\S*$/,
        patternMessage: "不能有空格",
        edit: true,
        required: false,
    }
]
//表单字段

export const FormField = {
    "DataHeader": {
        "title": "基础信息",
        "Field": FormDataHeader
    },
    "WorkInfoDataHeader": {
        "title": "工作及底薪信息",
        "Field": FormWorkInfoDataHeader
    }
}

//表格弹框表单字段
export const FormTableField = {
}

//渲染成字表表格的头
export const childTableColumn = {
    "promoterChangement": {
        "title": "变更历史",
        "type": "grid",
        "hidepage": {1:true,0:true,3:true},
        "column": columnpromoterChangement
    },
    // "portraitDataHeader": {
    //     "title": "附件",
    //     "type": "grid",
    //     "column": columnportrait
    // },
    "portrait": {
        "title": "附件",
        "type": "grid",
        "column": columnportrait
    },
}

//渲染成字表表格的头
export const mainTableColumn = [
    {
        title: "促销员编码",
        dataIndex: "code",
        width:120,
        key: "code",
        sorter: (pre, after) => {return pre.code > after.code},
        render: (text, record) => {
            return <a style={{ "cursor": "pointer" }}
                onClick={() => {
                    actions.routing.push(
                        {
                            pathname: 'Promoter-edit',
                            search: `?search_id=${record.id}&btnPageFlag=2`,
                        }
                    );
                    // location.reload();
                }}
            >
                {text}
            </a >;
        }
    },
    {
        title: "名称",
        dataIndex: "name",
        width:100,
        key: "name",
    },
    {
        title: "性别",
        dataIndex: "genderName",
        width: 80,
        key: "genderName",
    },
    {
        title: "工龄",
        dataIndex: "years",
        width: 80,
        key: "years",
    },
    {
        title: "销售品牌",
        dataIndex: "commodityBrandName",
        width:100,
        key: "commodityBrandName",
    },
    {
        title: "销售品类",
        dataIndex: "goodsCategoryName",
        width:120,
        key: "goodsCategoryName",
    },
    {
        title: "客户渠道",
        dataIndex: "customerChannelsName",
        width:100,
        key: "customerChannelsId",
    },
    {
        title: "出生日期",
        dataIndex: "birthDate",
        width:110,
        key: "birthDate",
        render: (text, record, index) => {
            return text && ts2Formatter(text);
        }
    },
    {
        title: "联系电话",
        dataIndex: "tel",
        width:100,
        key: "tel",
    },
    {
        title: "促销员类型",
        dataIndex: "promotertypeName",
        width:100,
        key: "promotertypeName",
    },
    {
        title: "RIS编码",
        dataIndex: "riscode",
        width:100,
        key: "riscode",
    },
    {
        title: "门店名称",
        dataIndex: "storecodeName",
        width:130,
        key: "storecodeName",
    },
    {
        title: "发运业务",
        dataIndex: "blameserviceName",
        key: "blameserviceName",
        width:140,
    },
    {
        title: "零售业务",
        dataIndex: "ext05Name",
        key: "ext05Name",
        width:140,
    },
    // {
    //     title: "大区",
    //     dataIndex: "saleareaName",
    //     width:120,
    //     key: "saleareaName",
    // },
    // {
    //     title: "地区",
    //     dataIndex: "saleregionName",
    //     width:120,
    //     key: "saleregionName",
    // },
    {
        title: "区域市场",
        dataIndex: "regionName",
        width:120,
        key: "regionName",
    },
    {
        title: "隶属客户",
        dataIndex: "terminalsupplierName",
        width:130,
        key: "terminalsupplierName",
    },
    {
        title: "审核状态",
        dataIndex: "state",
        width: 100,
        key: "state",
        fixed: "right",
        render: (text, record, index) => {
            return renderState(text);
        }
    },
    {
        title: "是否生成用户",
        dataIndex: "ext01",
        key: "ext01",
        width:100,
        render: (text) => {
            if (text == "Y") {
                return "是"
            } else {
                "否"
            }
        }
    },
    {
        title: "离职日期",
        dataIndex: "turnoverDate",
        key: "turnoverDate",
        width:120,
        render:(text) => {
            return text && ts2Formatter(text);
        }
    },
    {
        title: "年龄",
        dataIndex: "age",
        key: "age",
        width:120,
    },
    {
        title: "省市县镇",
        dataIndex: "provinceName",
        key: "provinceName",
        render: (text, record, index) => {
            let townName = record.townName?record.townName:"";
            return record.provinceName + record.cityName + record.countyName + townName;
        }
    },
    {
        title: "身份证号",
        dataIndex: "cardId",
        key: "cardId",
        width:140,
    },
    {
        title: "入职日期",
        dataIndex: "entryDate",
        key: "entryDate",
        width:120,
        render: (text, record, index) => {
            return text && ts2Formatter(text);
        }
    },
    {
        title: "入店日期",
        dataIndex: "arrivalDate",
        key: "arrivalDate",
        width:120,
        render: (text, record, index) => {
            return text && ts2Formatter(text);
        }
    }
]

export const searchField = [

    {
        enname: "branchbfficeId",
        zhname: "隶属组织",
        required: false,
        refname: "organization",
        multiple: true,
        param:{
            "AUTH_refdim":"branchbffice","AUTH_refcod":"promoter"
        },
        type: "RefComponent",
        edit: true
    },
    {
        enname: "code",
        zhname: "促销员编码",
        required: false,
        searchType: "like",
        type: "FormControl",
        edit: true
    },
    {
        enname: "name",
        zhname: "姓名",
        required: false,
        searchType: "like",
        type: "FormControl",
        edit: true
    },
    {
        enname: "tel",
        zhname: "联系电话",
        required: false,
        searchType: "like",
        type: "FormControl",
        edit: true
    },
    {
        enname: "storecodeId",
        zhname: "门店",
        required: false,
        refname: "terminal",
        multiple: true,
        type: "RefComponent",
        edit: true
    },
    {
        enname: "terminalsupplierId",
        zhname: "隶属客户",
        multiple: true,
        refname: "terminalcustomerRef",
        type: "RefComponent",
        edit: true
    },
    {
        enname: "customerChannelsId",
        zhname: "渠道",
        multiple: true,
        refname: "custchantype",
        param:{
            "EQ_enableState":"2"
        },
        type: "RefComponent",
        edit: true
    },
    {
        enname: "shippingareaId",
        zhname: "发运片区",
        refname: "departmentRef",
        multiple: true,
        type: "RefComponent",
        edit: true
    },
    {
        enname: "shippingareaSecLevelId",
        zhname: "发运地区",
        refname: "departmentRef",
        multiple: true,
        type: "RefComponent",
        edit: true
    },
    {
        enname: "shippingareaStairId",
        zhname: "发运大区",
        refname: "departmentRef",
        multiple: true,
        type: "RefComponent",
        edit: true
    },
    {
        enname: "retailId",
        zhname: "零售片区",
        refname: "departmentRef",
        multiple: true,
        type: "RefComponent",
        edit: true
    },
    {
        enname: "retailSecLevelId",
        zhname: "零售地区",
        refname: "departmentRef",
        multiple: true,
        type: "RefComponent",
        edit: true
    },
    {
        enname: "retailStairId",
        zhname: "零售大区",
        refname: "departmentRef",
        multiple: true,
        type: "RefComponent",
        edit: true
    },
    {
        enname: "blameserviceId",
        zhname: "发运业务",
        refname: "terminalPersonRef",
        multiple: true,
        type: "RefComponent",
        edit: true,
    },
    {
        enname: "ext05",
        zhname: "零售业务",
        refname: "terminalPersonRef",
        multiple: true,
        realRef: true,
        type: "RefComponent",
        edit: true,
    },
    {
        enname: "promotertypeId",
        zhname: "促销员类型",
        multiple: true,
        refname: "personType",
        type: "RefComponent",
        edit: true,
    },
    {
        enname: "turnoverStatus",
        zhname: "离职状态",
        type: "Radio",
        edit: true,
        options: [{
            key: 1,
            value: "已离职"
        },
        {
            key: 0,
            value: "未离职"
        }
        ]
    },
    {
        enname: "ext01",
        zhname: "是否生成用户",
        type: "Select",
        options: [
            {code:"Y",name:"是"},
            {code:"N",name:"否"}
        ],
        edit: true,
    },
    {
        enname: "creationTime",
        zhname: "创建日期",
        type: "RangePicker",
        rangeField: ["creationTime", "creationTime"],
        format: "YYYY-MM-DD",
        edit: true,
    },
    {
        enname: "modifiedTime",
        zhname: "更新日期",
        type: "RangePicker",
        rangeField: ["modifiedTime", "modifiedTime"],
        format: "YYYY-MM-DD",
        edit: true,
    }
]

export const headerButtonSets = [
    {
        event: "ButtonAdd",
        zhname: "新增",
        color: 'primary',
        authcode: "promoteradd",
    },
    {
        event: "ButtonBatchCreateUser",
        zhname: "生成用户",
        authcode: "promoterperson",
        modalContent: "确定生成用户吗",
        batch:true,
        method: "post",
        ContentType: 'application/x-www-form-urlencoded;charset=utf-8',
        url: 'occ-base/base/promoterst/saveuser'
    }
]

export const columnButtonSets = {
    "delete": {
        event: "ButtonDel",
        zhname: "删除",
        batch: true,
        method: "post",
        ContentType: 'application/x-www-form-urlencoded;charset=utf-8',
        url: 'occ-base/base/promoterst/deleteout'
    },
    "edit": true,
    "detail": true
}

// export default {mainTableColumn,searchField,headerButtonSets,
//     columnButtonSets,childTableColumn,FormTableField,FormField}
export const SelectCode = ["SZWD", "ZCLX", "QY020","BILL_STATUS","SP","OPERATION_TYPE"]
